//
//  AppSettingManager.m
//  JWBrowser
//
//  Created by Dejun Liu on 14-11-11.
//  Copyright (c) 2014年 JW. All rights reserved.
//

#import "AppSettingManager.h"

@interface AppSettingManager()

@property (nonatomic,strong,readonly) NSDictionary *confData;

@end

@implementation AppSettingManager

JW_SINGLETON_IMPL(AppSettingManager)

- (instancetype)init
{
    self = [super init];
    if (self) {
        NSBundle *bundle = [NSBundle mainBundle];
        NSString* settingsPath = [bundle pathForResource:@"AppSettingData" ofType:@"plist"];
        NSAssert(settingsPath, @"AppSettingData.plist not found in bundle %@", bundle);
        NSDictionary* dictionary = [NSDictionary dictionaryWithContentsOfFile:settingsPath];
        NSAssert(dictionary, @"Failed to load settings from AppSettingData.plist - check file format (bundle %@)", bundle);
        
        if(dictionary)
        {
            _confData = dictionary;
        }
    }
    return self;
}

- (NSString *)baseURL
{
    return [self.confData objectForKey:@"baseURL"];
}

@end
